<?php
namespace App\Providers;

use Illuminate\Support\ServiceProvider;
use App\Core\Entity\Session\UserEntity;
use App\Core\Entity\Session\LocationEntity;
use App\Http\Middleware\Awstats\Visit\Trade\Supply as VisitSupply;
use App\Http\Middleware\Awstats\Visit\Trade\Demand as VisitDemand;

class AppServiceProvider extends ServiceProvider
{

    /**
     * 延时加载提供器
     *
     * @var bool
     */
    protected $defer = true;

    /**
     * 启动应用服务
     *
     * @return void
     */
    public function boot()
    {
        //
    }

    /**
     * 注册服务提供器
     *
     * @return void
     */
    public function register()
    {
        // 单例 | 用户实体
        $this->app->singleton(UserEntity::class);
        // 单例 | 活跃地址实体
        $this->app->singleton(LocationEntity::class);
        // 单例 | 访问统计中间件 | 出售
        $this->app->singleton(VisitSupply::class);
        // 单例 | 访问统计中间件 | 求购
        $this->app->singleton(VisitDemand::class);
    }

    /**
     * 获取提供器提供的服务
     *
     * @return array
     */
    public function provides()
    {
        return [
            UserEntity::class,
            LocationEntity::class,
            VisitSupply::class,
            VisitDemand::class
        ];
    }
}
